/**
 * Created by xiangyufang on 2016/11/12.
 */
;(function ($, window, document, undefined) {

    /*** 全局变量 start ***/
    //页面跳转带过来的全局参数
    var $ambientId = $("#JQ_ambientId").val();
    var $ambientType = $("#JQ_ambientType").val();

    //通用的表单输入框
    var $recorder = $("#JQ_opinion"); //审核意见
    var $remark = $("#JQ_examine"); //审核通过
    var $rightRadio = $("#JQ_right_radio"); //记录时间
    var $errorRadio = $("#JQ_error_radio"); //记录时间
    var $save = $("#JQ_save");
    /*** 全局变量 end ***/

    $rightRadio.click(function(){
        $(this).addClass('active');
        $errorRadio.removeClass('active');
        $remark.val('20');
    });
    $errorRadio.click(function(){
        $(this).addClass('active');
        $rightRadio.removeClass('active');
        $remark.val('06');
    });

    var $info = $("#JQ_examine_info");
    var $imgDiv = $('#JQ_examine_img_div');
    var $img = $('#JQ_examine_img');
    if($ambientType == 'AEPipeLine'){
        DyyBase.ajax(ambientApi.url_ae_pipe_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadThirdInfo(data);
                }
            }
        });
    }else if($ambientType == 'TrafficFacilities'){
        DyyBase.ajax(ambientApi.url_ae_traffic_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadTrafficInfo(data);
                }
            }
        });
    }else if($ambientType == 'SpecificPlace'){
        DyyBase.ajax(ambientApi.url_ae_specific_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadSpecificInfo(data);
                }
            }
        });
    }else if($ambientType == 'Sewer'){
        DyyBase.ajax(ambientApi.url_ae_sewer_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadSewerInfo(data);
                }
            }
        });
    }else if($ambientType == 'GeologicHazard'){
        DyyBase.ajax(ambientApi.url_ae_geologic_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }

                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadGeologicInfo(data);
                }
            }
        });
    }else if($ambientType == 'EmergencyResource'){
        DyyBase.ajax(ambientApi.url_ae_emergency_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }

                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadEmergencyInfo(data);
                }
            }
        });
    }else if($ambientType == 'DifficultyRepair'){
        DyyBase.ajax(ambientApi.url_ae_difficulty_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadDifficultyInfo(data);
                }
            }
        });
    }else if($ambientType == 'PressObject'){
        DyyBase.ajax(ambientApi.url_ae_press_examine(), {id:$ambientId,type:'show'}, function(dataSet){
            if(dataSet.bool){
                if(dataSet.result.imgList){
                    $imgDiv.show();
                    var imgData = DyyBase.getImagePath(dataSet.result.imgList);
                    $img.loadAeImage(imgData);
                }
                if(dataSet.result){
                    var data = DyyBase.clearNull(dataSet.result);
                    loadPressInfo(data);
                }
            }
        });
    }

    //第三方管道设施
    function loadThirdInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>所属单位：</span><span title="'+ data.owner +'">'+ data.owner +'</span></p>';
        content += '<p><span>阴保方式：</span><span title="'+ data.cptype +'">'+ data.cptype +'</span></p>';
        content += '<p><span>联系人/单位：</span><span title="'+ data.contact +'">'+ data.contact +'</span></p>';
        content += '<p><span>联系方式：</span><span title="'+ data.telephone +'">'+ data.telephone +'</span></p>';
        content += '<p><span>相对位置关系：</span><span title="'+ data.relativePositionRelation +'">'+ data.relativePositionRelation +'</span></p>';
        if(data.relativePositionRelation == '交叉'){
            content += '<p>' +
                '<span>第三方管道及设施信息：</span>' +
                '<span>X：</span><span title="'+ data.crossX +'">'+ data.crossX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.crossY +'">'+ data.crossY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.crossZ +'">'+ data.crossZ +'</span></p>';
            content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
            content += '<p><span>垂直间距：</span><span title="'+ data.altitudeSeparation +'">'+ data.altitudeSeparation +'</span></p>';
        }else if(data.relativePositionRelation == '平行'){
            content += '<p>' +
                '<span>第三方起点：</span>' +
                '<span>X：</span><span title="'+ data.beginX +'">'+ data.beginX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.beginY +'">'+ data.beginY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.beginZ +'">'+ data.beginZ +'</span></p>';
            content += '<p><span>起点位置描述：</span><span title="'+ data.beginDescription +'">'+ data.beginDescription +'</span></p>';
            content += '<p>' +
                '<span>第三方终点：</span>' +
                '<span>X：</span><span title="'+ data.endX +'">'+ data.endX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.endY +'">'+ data.endY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.endZ +'">'+ data.endZ +'</span></p>';
            content += '<p><span>终点位置描述：</span><span title="'+ data.endDescription +'">'+ data.endDescription +'</span></p>';
            content += '<p><span>最小平行间距：</span><span title="'+ data.minDistance +'">'+ data.minDistance +'</span></p>';
        }
        content += '<p><span>是否为安全距离：</span><span title="'+ data.safeHeight +'">'+ data.safeHeight +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //交通设施
    function loadTrafficInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>所属单位：</span><span title="'+ data.owner +'">'+ data.owner +'</span></p>';
        content += '<p><span>联系人/单位：</span><span title="'+ data.contact +'">'+ data.contact +'</span></p>';
        content += '<p><span>联系方式：</span><span title="'+ data.telephone +'">'+ data.telephone +'</span></p>';
        content += '<p><span>相对位置关系：</span><span title="'+ data.relativePositionRelation +'">'+ data.relativePositionRelation +'</span></p>';
        if(data.relativePositionRelation == '交叉'){
            content += '<p>' +
                '<span>交通设施信息：</span>' +
                '<span>X：</span><span title="'+ data.crossX +'">'+ data.crossX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.crossY +'">'+ data.crossY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.crossZ +'">'+ data.crossZ +'</span></p>';
            content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
            content += '<p><span>垂直间距：</span><span title="'+ data.altitudeSeparation +'">'+ data.altitudeSeparation +'</span></p>';
        }else if(data.relativePositionRelation == '平行'){
            content += '<p>' +
                '<span>交通设施起点：</span>' +
                '<span>X：</span><span title="'+ data.beginX +'">'+ data.beginX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.beginY +'">'+ data.beginY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.beginZ +'">'+ data.beginZ +'</span></p>';
            content += '<p><span>起点位置描述：</span><span title="'+ data.beginDescription +'">'+ data.beginDescription +'</span></p>';
            content += '<p>' +
                '<span>交通设施终点：</span>' +
                '<span>X：</span><span title="'+ data.endX +'">'+ data.endX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.endY +'">'+ data.endY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.endZ +'">'+ data.endZ +'</span></p>';
            content += '<p><span>终点位置描述：</span><span title="'+ data.endDescription +'">'+ data.endDescription +'</span></p>';
            content += '<p><span>最小平行间距：</span><span title="'+ data.minDistance +'">'+ data.minDistance +'</span></p>';
            content += '<p><span>最小平行长度：</span><span title="'+ data.parallelLength +'">'+ data.parallelLength +'</span></p>';
        }
        content += '<p><span>是否为安全距离：</span><span title="'+ data.safeHeight +'">'+ data.safeHeight +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //特殊场所
    function loadSpecificInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>特定场所名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>特定场所类别：</span><span title="'+ data.category +'">'+ data.category +'</span></p>';
        content += '<p><span>特定场所类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>人口数量：</span><span title="'+ data.population +'">'+ data.population +'</span></p>';
        content += '<p>' +
            '<span>第三方管道及设施信息：</span>' +
            '<span>X：</span><span title="'+ data.positionX +'">'+ data.positionX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Y：</span><span title="'+ data.positionY +'">'+ data.positionY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Z：</span><span title="'+ data.positionZ +'">'+ data.positionZ +'</span></p>';
        content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
        content += '<p><span>与管道最小间距：</span><span title="'+ data.minDistance +'">'+ data.minDistance +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //地下排污排水
    function loadSewerInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>设施名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>设施类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>所属单位：</span><span title="'+ data.owner +'">'+ data.owner +'</span></p>';
        content += '<p><span>联系方式：</span><span title="'+ data.telephone +'">'+ data.telephone +'</span></p>';
        content += '<p><span>相对位置关系：</span><span title="'+ data.relativePositionRelation +'">'+ data.relativePositionRelation +'</span></p>';
        if(data.relativePositionRelation == '交叉'){
            content += '<div>交叉点信息：</div>';
            content += '<p><span>桩号：</span><span title="'+ data.crossNagmInput +'">'+ data.crossNagmInput +'</span></p>';
            content += '<p><span>相对桩的距离：</span><span title="'+ data.crossNagmMileageInput +'">'+ data.crossNagmMileageInput +'</span></p>';
            content += '<p>' +
                '<span>X：</span><span title="'+ data.crossX +'">'+ data.crossX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.crossY +'">'+ data.crossY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.crossZ +'">'+ data.crossZ +'</span></p>';

        }else if(data.relativePositionRelation == '平行'){
            content += '<div>平行段信息：</div>';
            content += '<p><span>起点位置：桩号：</span><span title="'+ data.beginNagmInput +'">'+ data.beginNagmInput +'</span></p>';
            content += '<p><span>相对桩的距离：</span><span title="'+ data.beginNagmMileageInput +'">'+ data.beginNagmMileageInput +'</span></p>';
            content += '<p>' +
                '<span>X：</span><span title="'+ data.beginX +'">'+ data.beginX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.beginY +'">'+ data.beginY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.beginZ +'">'+ data.beginZ +'</span></p>';
            content += '<p><span>终点位置：桩号：</span><span title="'+ data.endNagmInput +'">'+ data.endNagmInput +'</span></p>';
            content += '<p><span>相对桩的距离：</span><span title="'+ data.endNagmMileageInput +'">'+ data.endNagmMileageInput +'</span></p>';
            content += '<p>' +
                '<span>X：</span><span title="'+ data.endX +'">'+ data.endX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Y：</span><span title="'+ data.endY +'">'+ data.endY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
                '<span>Z：</span><span title="'+ data.endZ +'">'+ data.endZ +'</span></p>';
            content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
            content += '<p><span>最小平行间距：</span><span title="'+ data.minDistance +'">'+ data.minDistance +'</span></p>';
            content += '<p><span>是否密闭空间：</span><span title="'+ data.confinedSpace +'">'+ data.confinedSpace +'</span></p>'
        }
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //应急资源
    function loadGeologicInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>灾害类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>风险概率分值：</span><span title="'+ data.riskProbabilityScore +'">'+ data.riskProbabilityScore +'</span></p>';
        content += '<p><span>风险概率分级：</span><span title="'+ data.riskProbabilityLevel +'">'+ data.riskProbabilityLevel +'</span></p>';
        content += '<p><span>起点桩号：</span><span title="'+ data.beginNagmInput +'">'+ data.beginNagmInput +'</span></p>';
        content += '<p><span>起点相对桩的距离(m)：</span><span title="'+ data.beginNagmMileageInput +'">'+ data.beginNagmMileageInput +'</span></p>';
        content += '<p><span>终点桩号：</span><span title="'+ data.endNagmInput +'">'+ data.endNagmInput +'</span></p>';
        content += '<p><span>终点相对桩的距离(m)：</span><span title="'+ data.endNagmMileageInput +'">'+ data.endNagmMileageInput +'</span></p>';
        content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
        content += '<p><span>后果分级：</span><span title="'+ data.consequenceLevel +'">'+ data.consequenceLevel +'</span></p>';
        content += '<p><span>风险等级</span><span title="'+ data.riskLevel +'">'+ data.riskLevel +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //应急资源
    function loadEmergencyInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>应急资源名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>应急资源类别：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        if(data.province.indexOf('省')>0){
            if(data.city == '市辖区' || data.city == '辖区'){
                if(data.district == '其他'){
                    content += '<p><span>应急资源地址：</span><span title="'+ data.province + data.district + data.town +'">'+ data.province + data.district + data.town +'</span></p>';
                }else{
                    content += '<p><span>应急资源地址：</span><span title="'+ data.province + data.town +'">'+ data.province + data.town +'</span></p>';
                }
            }else{
                content += '<p><span>应急资源地址：</span><span title="'+ data.province + data.city + data.district + data.town +'">'+ data.province + data.city + data.district + data.town +'</span></p>';
            }
        }else{
            content += '<p><span>应急资源地址：</span><span title="'+ data.city + data.district + data.town +'">'+ data.city + data.district + data.town +'</span></p>';
        }
        content += '<p><span>联系人</span><span title="'+ data.contact +'">'+ data.contact +'</span></p>';
        content += '<p><span>联系方式：</span><span title="'+ data.telephone +'">'+ data.telephone +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //难以维修接近
    function loadDifficultyInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>编号：</span><span title="'+ data.customNumber +'">'+ data.customNumber +'</span></p>';
        content += '<div>起点位置：</div>';
        content += '<p><span>桩号：</span><span title="'+ data.beginNagmInput +'">'+ data.beginNagmInput +'</span></p>';
        content += '<p><span>相对桩的距离：</span><span title="'+ data.beginNagmMileageInput +'">'+ data.beginNagmMileageInput +'</span></p>';
        content += '<p>' +
            '<span>X：</span><span title="'+ data.beginX +'">'+ data.beginX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Y：</span><span title="'+ data.beginY +'">'+ data.beginY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Z：</span><span title="'+ data.beginZ +'">'+ data.beginZ +'</span></p>';
        content += '<div>终点位置：</div>';
        content += '<p><span>桩号：</span><span title="'+ data.endNagmInput +'">'+ data.endNagmInput +'</span></p>';
        content += '<p><span>相对桩的距离：</span><span title="'+ data.endNagmMileageInput +'">'+ data.endNagmMileageInput +'</span></p>';
        content += '<p>' +
            '<span>X：</span><span title="'+ data.endX +'">'+ data.endX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Y：</span><span title="'+ data.endY +'">'+ data.endY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Z：</span><span title="'+ data.endZ +'">'+ data.endZ +'</span></p>';
        content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
        content += '<p><span>难以接近原因：</span><span title="'+ data.reason +'">'+ data.reason +'</span></p>';
        content += '<p><span>记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //管道占压
    function loadPressInfo(infoData){
        var data =DyyBase.clearSpace(infoData);
        var content = '';
        content += '<p><span>管道名称：</span><span title="'+ data.pipeLineName +'">'+ data.pipeLineName +'</span></p>';
        content += '<p><span>占压名称：</span><span title="'+ data.name +'">'+ data.name +'</span></p>';
        content += '<p><span>占压类型：</span><span title="'+ data.type +'">'+ data.type +'</span></p>';
        content += '<p><span>联系人：</span><span title="'+ data.contact +'">'+ data.contact +'</span></p>';
        content += '<p><span>联系方式：</span><span title="'+ data.telephone +'">'+ data.telephone +'</span></p>';
        content += '<div>位置信息：</div>';
        content += '<p><span>桩号：</span><span title="'+ data.nagmInput +'">'+ data.nagmInput +'</span></p>';
        content += '<p><span>相对桩的距离：</span><span title="'+ data.nagmMileageInput +'">'+ data.nagmMileageInput +'</span></p>';
        content += '<p>' +
            '<span>X：</span><span title="'+ data.positionX +'">'+ data.positionX +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Y：</span><span title="'+ data.positionY +'">'+ data.positionY +'&nbsp;&nbsp;&nbsp;&nbsp;</span>' +
            '<span>Z：</span><span title="'+ data.positionZ +'">'+ data.positionZ +'</span></p>';
        content += '<p><span>位置描述：</span><span title="'+ data.locationDescription +'">'+ data.locationDescription +'</span></p>';
        content += '<p><span>最小间距：</span><span title="'+ data.minDistance +'">'+ data.minDistance +'</span></p>';
        content += '<p><span>管道埋深：</span><span title="'+ data.coverDepth +'">'+ data.coverDepth +'</span></p>';
        var findData = data.foundDate.slice(0,10);
        content += '<p><span>发现日期：</span><span title="'+ findData +'">'+ data.foundDate +'</span></p>';
        content += '<p><span>发现方式：</span><span title="'+ data.foundWay +'">'+ data.foundWay +'</span></p>';
        content += '<p><span>巡线记录人：</span><span title="'+ data.recorder +'">'+ data.recorder +'</span></p>';
        content += '<p><span>记录时间：</span><span title="'+ data.recordTime +'">'+ data.recordTime +'</span></p>';
        content += '<p><span>备注：</span><span title="'+ data.remarks +'">'+ data.remarks +'</span></p>';
        $info.html(content);
    }

    //提交审核结果
    $save.click(function(){
        var submitUrl;
        var returnUrl;
        if($ambientType == 'AEPipeLine'){
            submitUrl = ambientApi.url_ae_pipe_pass();
            returnUrl = ambientApi.url_ae_pipe_success();
        }else if($ambientType == 'TrafficFacilities'){
            submitUrl = ambientApi.url_ae_traffic_pass();
            returnUrl = ambientApi.url_ae_traffic_success();
        }else if($ambientType == 'SpecificPlace'){
            submitUrl = ambientApi.url_ae_specific_pass();
            returnUrl = ambientApi.url_ae_specific_success();
        }else if($ambientType == 'Sewer'){
            submitUrl = ambientApi.url_ae_sewer_pass();
            returnUrl = ambientApi.url_ae_sewer_success();
        }else if($ambientType == 'GeologicHazard'){
            submitUrl = ambientApi.url_ae_geologic_pass();
            returnUrl = ambientApi.url_ae_geologic_success();
        }else if($ambientType == 'EmergencyResource'){
            submitUrl = ambientApi.url_ae_emergency_pass();
            returnUrl = ambientApi.url_ae_emergency_success();
        }else if($ambientType == 'DifficultyRepair'){
            submitUrl = ambientApi.url_ae_difficulty_pass();
            returnUrl = ambientApi.url_ae_difficulty_success();
        }else if($ambientType == 'PressObject'){
            submitUrl = ambientApi.url_ae_press_pass();
            returnUrl = ambientApi.url_ae_press_success();
        }
        submitPass(submitUrl,returnUrl);
    });
    function submitPass(url,returnUrl){
            var $auditContent = $recorder.val();
            var $auditStated = $remark.val();
            DyyBase.ajax(url, {id:$ambientId,dataStated:$auditStated,auditContent:$auditContent}, function(dataSet){
                if(dataSet.bool){
                    $recorder.MSG({
                        type: 'success',
                        height: 300,
                        content: '审核完成',
                        yesBtnTxt: '确认',
                        yesBtnAct: function(){
                            window.location.href = returnUrl;
                        }
                    });
                }
            });
    }

})(jQuery, window, document);